<template>
	<div class="heightMax publicbox" v-loading='loading'>
			<div class="listName">
				<i></i><span class="font14">统计信息</span>
			</div>
			<el-form :model="form" size="mini" ref='form'>
				<el-form-item label="钢丝绳折弯次数:">
					<span class="fl">{{form.steelNumber}}</span>
				</el-form-item>
				<el-form-item label="运行次数:">
					<span class="fl">{{form.operationNumber}}</span>
				</el-form-item>
				<el-form-item label="开关门次数:">
					<span class="fl">{{form.doorNumber}}</span>
				</el-form-item>
				<el-form-item label="运行时间(s):">
					<span class="fl">{{form.operationTime}}</span>
				</el-form-item>
			</el-form>
	</div>
</template>

<script>
	import {
		loadFn,
		axiosPost,
		axiosGet,
		axiosDelete,
		axiosPut,
		moment
	} from "@/common.js";
	export default {
		mounted() {
			this.getList()
		},
		computed:{
			liftId() {
				if (localStorage.liftDetailId) {
					return JSON.parse(localStorage.liftDetailId).id
				} else {
					return ''
				}
			}
		},
		data() {
			return {
				loading:false,
				form: {
					steelNumber: '',
					operationNumber: '',
					doorNumber: '',
					operationTime: ''
				}
			}
		},
		methods:{
			getList(){
				if(this.liftId){
					this.loading = true
					let params = {
						id:this.liftId
					}
					axiosGet('/manu/elevator/record/statistics',params,(res)=>{
						this.loading = false
						if(res.code == 0){
							this.form.steelNumber = res.detail.statistics.bend_times
							this.form.operationNumber = res.detail.statistics.run_times
							this.form.doorNumber = res.detail.statistics.open_times
							this.form.operationTime = res.detail.statistics.up_time
						}else{
							this.$message.error(res.detail.result)
						}
					})
				}
			}
		}
	}
</script>

<style scoped lang="less">
	.listName {
		display: flex;
		justify-content: flex-start;
		text-align: left;
		align-items: center;
		margin-bottom: 10px;
		margin-top: 5px;

		i {
			width: 3px;
			height: 15px;
			background: #2d8cf0;
			margin: 5px 5px;
		}
	}

	.el-form {
		padding-left: 20px;
		box-sizing: border-box;
	}
</style>
